package com.gua.jbs.serviceImpl;

import java.util.*;

import org.apache.log4j.Logger;

import com.gua.jbs.dao.IInvoiceDao;
import com.gua.jbs.daoImpl.InvoiceDao;
import com.gua.jbs.service.IInvoiceService;
import com.gua.jbs.utility.ApplicationException;
import com.gua.jbs.utility.ExceptionMessage;

public class InvoiceService extends BaseService implements IInvoiceService {
	
	private static final Logger logger = Logger.getLogger(ProductService.class);

	@Override
	public List<String> generatedInvoice() throws ApplicationException {
		// TODO Auto-generated method stub
		IInvoiceDao invoiceDAO=new InvoiceDao();
		List<String> list_invoiceNo=new ArrayList<String>();
		try{
			// TO DO
		list_invoiceNo=invoiceDAO.getGeneratedInvoiceNo();
		} catch (ApplicationException ae) {
			throw ae;
		} catch (Exception e) {
			logger.error("InvoiceService : gereated() ----> "
					+ e.getMessage());
			throw new ApplicationException(
					ExceptionMessage.INVOICE_NOT_UNABLE);
		}
		return list_invoiceNo;
	}

	public boolean updateInvoiceNumber(String invoiceValue)
			throws ApplicationException {
		// TODO Auto-generated method stub
		IInvoiceDao invoiceDAO=new InvoiceDao();
		boolean isUpdate=false;
		try{
			isUpdate=invoiceDAO.updateInvoiceNo(invoiceValue);
		} catch (ApplicationException ae) {
			throw ae;
		} catch (Exception e) {
			logger.error("InvoiceService : updateInvoice() ----> "
					+ e.getMessage());
			throw new ApplicationException(
					ExceptionMessage.INVOICE_NOT_UPDATED);
		}
		return isUpdate;

	}

}
